// ActionScript file
package com.app.commands{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.app.business.DosenDelegate;
	import com.app.control.DoUpdateProfilDosenEvent;
	import com.app.model.ModelLocator;
	import com.app.vo.DosenVO;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	
    
    public class DoUpdateProfilDosenCommand implements ICommand,IResponder{
        private var model:ModelLocator=ModelLocator.getInstance();
        public function execute(event:CairngormEvent):void{
            model.dosen.isPending=true;
            var delegate : DosenDelegate= new DosenDelegate(this);
            var doUpdateDosen :DoUpdateProfilDosenEvent= DoUpdateProfilDosenEvent(event);
            delegate.doUpdateProfilDosen(doUpdateDosen.dosenVo);
        }
        public function result(data:Object):void{
            model.dosen.isPending=false;
            model.dosen.dosenVo=DosenVO(data);
            Alert.show( "Profil Dosen Berhasil Di ubah","Alert");
        }
        public function fault(info:Object):void{
            Alert.show( "Get Info Dosen Failed","Alert");
            model.dosen.isPending = false;
        }
    }
}